# Load CUDA using the following command
# module load cuda

#
# Dirac
#
CC = nvcc
MPCC = nvcc
CFLAGS = -O3 -arch sm_20
NVCCFLAGS = -O3 -arch sm_20
#CFLAGS = -g -G -arch sm_20
#NVCCFLAGS = -g -G  -arch sm_20 
LIBS = -lm

TARGETS = serial implementation1 gpu implementation2

all:	$(TARGETS)

serial: serial.o common.o
	$(CC) -o $@ $(LIBS) serial.o common.o
gpu: gpu.o es-bvs-bl-common.o
	$(CC) -o $@ $(NVCCLIBS) gpu.o es-bvs-bl-common.o
implementation2: implementation2.o es-bvs-bl-common.o
	$(CC) -o $@ $(NVCCLIBS) implementation2.o es-bvs-bl-common.o
implementation1: implementation1.o es-bvs-bl-common.o
	$(CC) -o $@ $(NVCCLIBS) implementation1.o es-bvs-bl-common.o

serial.o: serial.cu common.h
	$(CC) -c $(CFLAGS) serial.cu
gpu.o: gpu.cu es-bvs-bl-common.h
	$(CC) -c $(NVCCFLAGS) gpu.cu
implementation2.o: implementation2.cu es-bvs-bl-common.h
	$(CC) -c $(NVCCFLAGS) implementation2.cu
implementation1.o: implementation1.cu es-bvs-bl-common.h
	$(CC) -c $(NVCCFLAGS) implementation1.cu
common.o: common.cu common.h
	$(CC) -c $(CFLAGS) common.cu
es-bvs-bl-common.o: es-bvs-bl-common.cu es-bvs-bl-common.h
	$(CC) -c $(CFLAGS) es-bvs-bl-common.cu

clean:
	rm -f *.o $(TARGETS)
